package shangji1;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 员工类，用于实现自我介绍功能
 */
public class Employee {
    private static final Logger logger = LoggerFactory.getLogger(Employee.class);

    // 属性定义
    private String name;
    private int age;
    private String position;

    // 无参构造器
    public Employee() {
        logger.info("Employee类的无参构造器被调用");
    }

    // 有参构造器
    public Employee(String name, int age, String position) {
        this.name = name;
        this.age = age;
        this.position = position;
        logger.info("Employee类的有参构造器被调用: name={}, age={}, position={}", name, age, position);
    }

    // getter和setter方法
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
        logger.info("设置员工姓名: {}", name);
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
        logger.info("设置员工年龄: {}", age);
    }

    public String getPosition() {
        return position;
    }

    public void setPosition(String position) {
        this.position = position;
        logger.info("设置员工岗位: {}", position);
    }

    // 自我介绍方法
    public void introduce() {
        String introduction = "大家好，我是" + position + "岗位的" + name + "，今年" + age + "岁。";
        logger.info(introduction);
        System.out.println(introduction);
    }
}